package com.titar.robot.http.service;


import com.titar.robot.Constants;
import com.titar.robot.base.BaseModel;
import com.titar.robot.entity.LoginResponse;
import com.titar.robot.entity.MemberInfo;
import com.titar.robot.entity.RegistResponse;
import com.titar.robot.entity.VerifyCodeResponse;
import com.titar.robot.http.ApiResponse;

import androidx.lifecycle.LiveData;
import io.reactivex.Flowable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Headers;
import retrofit2.http.POST;

public interface CustomerService {

    @FormUrlEncoded
    @POST(Constants.LOGIN_URL)
    @Headers("Accept: application/json")
    LiveData<ApiResponse<BaseModel<LoginResponse>>> login(@Field("phone") String phone, @Field("password") String password);

    @FormUrlEncoded
    @POST(Constants.MEMBERINFO_URL)
    @Headers("Accept: application/json")
    LiveData<ApiResponse<BaseModel<MemberInfo>>> getMemberInfo(@Field("token") String token);

    @FormUrlEncoded
    @POST(Constants.GET_VERIFY_CODE_URL)
    @Headers("Accept: application/json")
    LiveData<ApiResponse<BaseModel<VerifyCodeResponse>>> getVerifyCode(@Field("phone") String phone, @Field("type") int type);

    @FormUrlEncoded
    @POST(Constants.REGISTER_URL)
    @Headers("Accept: application/json")
    LiveData<ApiResponse<BaseModel<RegistResponse>>> regist(@Field("phone") String phone, @Field("password") String psw, @Field("name") String name, @Field("verifyCode") String verifyCode);

    @FormUrlEncoded
    @POST(Constants.FIND_PASSWORD_URL)
    @Headers("Accept: application/json")
    LiveData<ApiResponse<BaseModel<String>>> findPassword(@Field("phone") String phone, @Field("password") String psw, @Field("verifyCode") String verifyCode);

}